UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '87yI6ZcPfu7XK9K5Tq9cAgCxjFvq31iscUf4qLzswvA='
WHERE
key_id = 'c0f195b9e03ce9240b304f7e324ea8368a5a9beb646a56c54cde705595bbecc7'
AND (
token = '87yI6ZcPfu7XK9K5Tq9cAgCxjFvq31iscUf4qLzswvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)