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