UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HOp0JWbY+FnCZHUCUKa7f/dBca+E06JLXG/C18wrjmc='
WHERE
key_id = 'e4ec7f211e5a4bba0016406b00ce89e078103de4a38f9a8e88a9c4769c222931'
AND (
token = 'HOp0JWbY+FnCZHUCUKa7f/dBca+E06JLXG/C18wrjmc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)