UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cegAdNmdsS10DWCLnCyye4hM+VpeKEq+E5o+RH7AjUY=' 
WHERE 
  key_id = 'd5a64e35ee8ddbc702e10ebea095b4d23e8d5933a7f6c23ca2a733374940cdd9' 
  AND (
    token = 'cegAdNmdsS10DWCLnCyye4hM+VpeKEq+E5o+RH7AjUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027