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