UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AmpuQMGB+vFa0tAEF1M3UH3LO5hUYISUj07IjaEo8hg=' 
WHERE 
  key_id = '04512d9a7b06ce33257eb7f5ba74e5ee8294732346e4fdae33a8647a132bf992' 
  AND (
    token = 'AmpuQMGB+vFa0tAEF1M3UH3LO5hUYISUj07IjaEo8hg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033