UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MmqQrSxJvl6O5jDj9hxurwThiy+ce/PWbOj8q2REZHw='
WHERE
key_id = '49c5eed7e477a0f1ae5c4f02fab1883c94c7fdd90b2ca2a08a0f1fe2dbe25734'
AND (
token = 'MmqQrSxJvl6O5jDj9hxurwThiy+ce/PWbOj8q2REZHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)