UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'esu8Vtcw06S4FO1K8O7JZPMfKPCZ5ZgCD+l9KYQnruo=' 
WHERE 
  key_id = 'fb2d30ff479a436f45a8378bad2858d07cb396eb7604170462e13fb9019a15e2' 
  AND (
    token = 'esu8Vtcw06S4FO1K8O7JZPMfKPCZ5ZgCD+l9KYQnruo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027