UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mxyY3bSYB5FH9RqmLJRqt89ZbgQBJmQeOk9Cw5kOhs4='
WHERE
key_id = 'd77872ba3cf2c7ed626892473b045bb7b266c9525861c55921e25068c9472747'
AND (
token = 'mxyY3bSYB5FH9RqmLJRqt89ZbgQBJmQeOk9Cw5kOhs4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)