UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PotEaSn0xG+z6JoOevRYzWbSTVwP7jIYjqjSQl+PfDE=' 
WHERE 
  key_id = '344f2a0bbd538abc2fbce8e879353203794e966d722de47daeeae74358a52e06' 
  AND (
    token = 'PotEaSn0xG+z6JoOevRYzWbSTVwP7jIYjqjSQl+PfDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037