UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OeJj4zljhgWMqxolGh3X6gfGxNxnUeFmIReNbIvJNCw='
WHERE
key_id = '66da6cae98446b62d18c1edb4b8d9502bdeb1eab1780377a332e63a434fd43cf'
AND (
token = 'OeJj4zljhgWMqxolGh3X6gfGxNxnUeFmIReNbIvJNCw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)