UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1D/oq9nzuMNTAwwDv84CmED43t2uJIiem8xXEwXqZyE='
WHERE
key_id = 'a5b77df9a7f3cb93e39ede41ceded1846c41d229da6c35379a0956902551d653'
AND (
token = '1D/oq9nzuMNTAwwDv84CmED43t2uJIiem8xXEwXqZyE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)