UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6AF0GmG3EMArhA2QIfmBCZKnAZkSXjpxbD14vo6WZU='
WHERE
key_id = '0450dfd785f22b8b245221e49fd1e66e3647775bcdf043a49523f07eb8f5227b'
AND (
token = 'a6AF0GmG3EMArhA2QIfmBCZKnAZkSXjpxbD14vo6WZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)