UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7OCQsreBGrhE0WkrLTH9Hmf2u+SPVO3OxeCoHOkwuOw=' 
WHERE 
  key_id = '15cf4996b6eaa9f20f29e8f6284d45dc735926dc840c025cccdd5f19d83a2ae7' 
  AND (
    token = '7OCQsreBGrhE0WkrLTH9Hmf2u+SPVO3OxeCoHOkwuOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033