UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qhgCXG6uUXwjN88AKBVTIg0Un1UAlSuswbvMu3UNmpo='
WHERE
key_id = '04d260c1d05c411003269c4d9f40e7825637a6c7d720fe58eead2753967c68ef'
AND (
token = 'qhgCXG6uUXwjN88AKBVTIg0Un1UAlSuswbvMu3UNmpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)