UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xnox+0vAhH1dCH8znQLPMIWdp6r3p4KfGJcotm2dqAg=' 
WHERE 
  key_id = '002e3fbdc8a17c6a037c50fd30eec03eeb5b0e5b9021971311121fecd6a17099' 
  AND (
    token = 'xnox+0vAhH1dCH8znQLPMIWdp6r3p4KfGJcotm2dqAg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049