UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UURnP8SeojVF29H2wjsRs5FS415DGqczwmlP9MZZaN4=' 
WHERE 
  key_id = 'ebae0bd5d64a6de829ee2e615b2d5039c8ce9e2dc3f9e7923552741c6d407c5b' 
  AND (
    token = 'UURnP8SeojVF29H2wjsRs5FS415DGqczwmlP9MZZaN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038