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