UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2XrY4JmMLWnrGj5rpsRIcQdfDyTTQXi5lGZa3tpf6Bo='
WHERE
key_id = 'edfa84512a550ac81e56fe4ecb56de358f74faf6663816f6588a6f8f2ba330ca'
AND (
token = '2XrY4JmMLWnrGj5rpsRIcQdfDyTTQXi5lGZa3tpf6Bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)