UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Rx3swqAWRNduvAYmBPYGddrOvpMjdtZeKKLP4VACEWI='
WHERE
key_id = '505cbe5cada3c5edbcfaf90709ffe40ed6552bc121fd152b4a609594f0bc6c6c'
AND (
token = 'Rx3swqAWRNduvAYmBPYGddrOvpMjdtZeKKLP4VACEWI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)