UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bQyA9u0thC04fIEzCb9nljW4zJVAfhJv+tOe+NpLlP0='
WHERE
key_id = 'e28de4603fd047f21dbbfaeaf0bb879c16453fc97dad8b7cf78ceb47a892aa97'
AND (
token = 'bQyA9u0thC04fIEzCb9nljW4zJVAfhJv+tOe+NpLlP0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)