UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lEHNEk0wony0f2grUA7yJIjQvOoRgXwQN6IUknbUJ14=' 
WHERE 
  key_id = '87b672bd84d80017ff92d420c166bc9404bdf0794d5e0b1e084298cdbbc939ac' 
  AND (
    token = 'lEHNEk0wony0f2grUA7yJIjQvOoRgXwQN6IUknbUJ14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017