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