UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wsVduTMbETCxzRq6sYy7XZjLtjZ96gvbseL9WbZt3+I='
WHERE
key_id = '58cce6fb0f8964bf5ac5f8fa54c4da6f6297fd57c0677170770f336f50f69a9e'
AND (
token = 'wsVduTMbETCxzRq6sYy7XZjLtjZ96gvbseL9WbZt3+I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)