UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LMytW/QobHm4hBGzre8dRPVY4yotLdYTv1vf7J6FM2g=' 
WHERE 
  key_id = '1ad0f20f40cc1fd28adc7460278f111b412003a58a3e743152c55c5dc413c2ce' 
  AND (
    token = 'LMytW/QobHm4hBGzre8dRPVY4yotLdYTv1vf7J6FM2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060