UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'goDHq0JuFYQa0C0oJK0YYFZnwwCRp7nFdocAJRnYRag='
WHERE
key_id = '66191044f8cc38bfbcdb182ef32d0f8f4c4fb522e4d3140ddccc5015dedb6069'
AND (
token = 'goDHq0JuFYQa0C0oJK0YYFZnwwCRp7nFdocAJRnYRag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)