UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1huKapvShwONEPBk1I7qHEBMNvv6FYthlS0VuENpYBU=' 
WHERE 
  key_id = 'c1996992269ecfa111016272b2f046bdfcafda5f5a182858a7f85124af985d17' 
  AND (
    token = '1huKapvShwONEPBk1I7qHEBMNvv6FYthlS0VuENpYBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042