UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7HZ7h3Qq9zo0ag92TfjeXbmDDlzKI3f35HV9j+ie+wc='
WHERE
key_id = '7a98bd7e37244745945cabad6a1e3cdd2ff141c65f20ec1ce39b54157a05f1d0'
AND (
token = '7HZ7h3Qq9zo0ag92TfjeXbmDDlzKI3f35HV9j+ie+wc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)