UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cQF+RYsLupMg5usR2av3SDr4102myLCHUGgTXeWR9vg=' 
WHERE 
  key_id = 'be969b6ce002d78a456caf1214d6c5bba0577225ee418543632b582365d76a7d' 
  AND (
    token = 'cQF+RYsLupMg5usR2av3SDr4102myLCHUGgTXeWR9vg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038