UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HxPM0H8gbK/OWmBMjhbSLzSDVsoqW8c6pNsR+ahtU2Y=' 
WHERE 
  key_id = 'b8e2203392cb93210b27a753411fec6140ffd482bbacef20948f0fbdbb5d59cc' 
  AND (
    token = 'HxPM0H8gbK/OWmBMjhbSLzSDVsoqW8c6pNsR+ahtU2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051