UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c4ceqiWguSCjiPm/BCqr0Cy6wUXnB6NC/igsal6CTFU='
WHERE
key_id = 'f1d482a1a56583490f9266466014db73ab249bb747bd45e95291b19a56cdfc4b'
AND (
token = 'c4ceqiWguSCjiPm/BCqr0Cy6wUXnB6NC/igsal6CTFU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)