UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I0fotndhwfXx7btTeU4KHFUQCBpkKra+jnzrTtu2JK8='
WHERE
key_id = 'c00a4e87e9e694745656878f21dc7670b197c4093d8ca9a5b0301874155360a5'
AND (
token = 'I0fotndhwfXx7btTeU4KHFUQCBpkKra+jnzrTtu2JK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)