UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YcdWgdaNhmFlgRBOCOrpTfvhB8vymJ8PuFCJvXBOtIE=' 
WHERE 
  key_id = '22ab8534acc1b40256271ebf2a1c9db3360b69bea98710588fc974d3928dae0f' 
  AND (
    token = 'YcdWgdaNhmFlgRBOCOrpTfvhB8vymJ8PuFCJvXBOtIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030