UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L6jM1r32L34BngQAu8GxhkXZR+MWEqvH3nsJQqGE1lM=' 
WHERE 
  key_id = '5df31509bd7edd20a8aa8ea4180537b7c899c776cea77a409828a9d8a2464c4a' 
  AND (
    token = 'L6jM1r32L34BngQAu8GxhkXZR+MWEqvH3nsJQqGE1lM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024