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