UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yFD6pIeZUfPTaSXpklzdpm8RSWciiiiotQHr8yHPaG8=' 
WHERE 
  key_id = '346942040306c5796da90f1badeabe1055232b29037dfac8e5e31d682dd430c5' 
  AND (
    token = 'yFD6pIeZUfPTaSXpklzdpm8RSWciiiiotQHr8yHPaG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037