UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YuN0+Svg2OnXUv+7tFzPvVGOvBLh4kEkFAZ5QuVYuvI=' 
WHERE 
  key_id = '344ca9e06048ec3dbbc7654110991d0ad61e061977126270ee2e5ea2a5ccc3b9' 
  AND (
    token = 'YuN0+Svg2OnXUv+7tFzPvVGOvBLh4kEkFAZ5QuVYuvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025