UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IiAe1yAQyiPBJnwgrgT3WYkvcQpIMH4um8qw08M7u9k=' 
WHERE 
  key_id = '15dac43becbc06b8cbf1e170ede8977597a26a3a92be771a773b630b0133eb3c' 
  AND (
    token = 'IiAe1yAQyiPBJnwgrgT3WYkvcQpIMH4um8qw08M7u9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037