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