UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qwju3TxBxnRDdfdI16QcSfyF5GAYLUv/caLB6Lx0Va8=' 
WHERE 
  key_id = '793a6d43dd98c9799e7bef4195639eaecd66763980e38e9a81b435ebee0ef19d' 
  AND (
    token = 'Qwju3TxBxnRDdfdI16QcSfyF5GAYLUv/caLB6Lx0Va8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036