UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TG4HSwSXT+L8nJiwpYiBj4AvRaYUMQkjS3X8igg9yws=' 
WHERE 
  key_id = 'd000ad4bb9ded41148c7b642a2bf094796a5885020932ef85f9be766f8a18e13' 
  AND (
    token = 'TG4HSwSXT+L8nJiwpYiBj4AvRaYUMQkjS3X8igg9yws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027