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