UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LSHd70P13+zVzLPMAQaLlW5JXKyAlpEiPSye52v1LGI='
WHERE
key_id = '3cd08c5c5f849a3692461efdcb49408f25020cfc6a75a72746302a9d28ae72c2'
AND (
token = 'LSHd70P13+zVzLPMAQaLlW5JXKyAlpEiPSye52v1LGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)