UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u+D1fklAl2vLhJVUQpoojV8Lm8/kOmm2TxS8+s0yiSY='
WHERE
key_id = 'd32e46965caa8839a2c554b294393e53f188d222a99d09271600d06a6105c44d'
AND (
token = 'u+D1fklAl2vLhJVUQpoojV8Lm8/kOmm2TxS8+s0yiSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)