UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NpEWs0W8ABWIzpSLUQP+hPwMGLfTfxNDjMtken5CLn0='
WHERE
key_id = 'f805c324b875b5f3e8d8abdee09e02d5922e7e2e06a34df4d78c6c35517c6e53'
AND (
token = 'NpEWs0W8ABWIzpSLUQP+hPwMGLfTfxNDjMtken5CLn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)