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