UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hA4hYK8jrzMCN2zIqiS7i/2p5G0+dXpWSZ87LVAdVSo=' 
WHERE 
  key_id = '2c448893c067e1f03d9fb54adb05457d27923e6443fa0a885f14282393e63db3' 
  AND (
    token = 'hA4hYK8jrzMCN2zIqiS7i/2p5G0+dXpWSZ87LVAdVSo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029