UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'll8cp4+QjgmUrXz7pvnGyhORresBdQO6AdThQO9JsaM=' 
WHERE 
  key_id = '833a372bf1730691929e4d7ae5a518fb321f6fc10a5dfbb74333471d63adf917' 
  AND (
    token = 'll8cp4+QjgmUrXz7pvnGyhORresBdQO6AdThQO9JsaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042