UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6ZTDiLMfTOQ2fpopN1GAp9OPGMbJ2ung/S4KDHsHvIw='
WHERE
key_id = 'f40978e885aa15dcabf047dd098cb59c72a047b3e4670100e003a4c14d9acc6a'
AND (
token = '6ZTDiLMfTOQ2fpopN1GAp9OPGMbJ2ung/S4KDHsHvIw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)