UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LGg6h/cbd9pZqnKL5sqlnB1EKv1nC9PngIYfrexedbk=' 
WHERE 
  key_id = '1b2962829d3da56941da3f85d2410f6e3598e1df52f8e17e59637d09195c79f9' 
  AND (
    token = 'LGg6h/cbd9pZqnKL5sqlnB1EKv1nC9PngIYfrexedbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028