UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BfUYKc+FhEBPSDIkCgHDjzIjGVvNzfigzDGEmumhzt0=' 
WHERE 
  key_id = '2a786c889b8a87355288091b859f9b252cc451a256abcd4ea7c9f0014a961916' 
  AND (
    token = 'BfUYKc+FhEBPSDIkCgHDjzIjGVvNzfigzDGEmumhzt0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045