UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5qtcIMwHqTYAt6pSP4Wc4vA1qhKSEFR1yL4AXOuhVRc='
WHERE
key_id = 'ad8f50a1ed2989dbeaa95af8107a7903d1e9431db7c668e672bd9429d9f58b90'
AND (
token = '5qtcIMwHqTYAt6pSP4Wc4vA1qhKSEFR1yL4AXOuhVRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)